#!/sbin/openrc-run

# fallback values for /etc/conf.d/autoscan
: ${command_user:=autoscan:autoscan}
: ${directory:=/var/lib/autoscan}
: ${logdir:=/var/log/autoscan}

name=autoscan
description="autoscan daemon"
command="/usr/bin/autoscan"
command_args="
	--config=$directory/config.yml
	--database=$directory/autoscan.db
	--log=$directory/activity.log"
command_background=true

pidfile="/run/$name.pid"
output_log="$logdir/output.log"
error_log="$logdir/error.log"

depend() {
	need net
	use dns logger netmount
}

start_pre() {
	checkpath -d -o "$command_user" "$directory" "$logdir"
	checkpath -f -o "$command_user" "$output_log" "$error_log"
}
